using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using System.Collections;
using WEB.DAL.DBManagers;
using log4net;
using WEB.Exceptions;
using WEB.BLL.Entities;
namespace WEB.BLL.Services
{
	#region IStudentService

	/// <summary>
	/// Student_Service object for Ibatis mapped table 'Student'.
	/// </summary>
	public class IStudentService : BaseSqlMapDao{
		private static readonly ILog log = LogManager.GetLogger(typeof(BaseSqlMapDao).Name);
	
		public IList<StudentEntity> LoadData()
        {
            try
            {
                return ExecuteQueryForList<StudentEntity>("StudentLoadAll", null);
            }
          catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
       public StudentEntity LoadByPrimaryKey(StudentEntity objE)
        {
            try
            {
                return ExecuteQueryForObject<StudentEntity>("StudentLoadPrimaryKey", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        
        /// <summary>
        /// add new Student to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Insert(StudentEntity objE)
        {
            try
            {
                ExecuteInsert("StudentInsert", objE);
                return 1;
            }
           catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        /// <summary>
        /// update Student to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Update(StudentEntity objE)
        {
            try
            {
                ExecuteUpdate("StudentUpdate", objE);
                return 1;
            }
           catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        /// <summary>
        /// delete Student to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Delete(StudentEntity objE)
        {
            try
            {
                ExecuteDelete("StudentDelete", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
	}
	#endregion  
}
